<?php

  class dbs{
     
      function __construct($url,$user,$pwd){
          $this->conn = new PDO($url, $user, $pwd);
         
          $this->conn->exec("SET NAMES UTF8");
          
      }
      
       function getQuery($sql){
          return $this->conn->query($sql);
      }
      
     public function end(){
          $sql = "select * from user";
          $rs = $this->conn->query($sql);
          
          while($row = $rs->fetch(PDO::FETCH_OBJ)){
              $rows[] = $row;
          }
          
          $counts = count($rows);
          
          return $counts%3>0?intval($counts/3)+1:$counts/3;
      }
  }
  
$dbs = new dbs("mysql:host=localhost:3307;dbname=php","root","root");
$end = $dbs->end();
